package com.videoaggre.zcl.ui.fragment

import android.os.Bundle
import android.view.View
import com.tencent.smtt.sdk.WebView
import com.videoaggre.zcl.parse.IParse
import com.videoaggre.zcl.ui.widget.X5WebView

fun parseHtml(iParse: IParse) {
    ParseHtmlFragment.parseHtml(iParse)
}

class ParseHtmlFragment : BaseFragment() {
    companion object {
        private lateinit var mParseHtmlFragment: ParseHtmlFragment
        fun newInstance(): ParseHtmlFragment {
            mParseHtmlFragment = ParseHtmlFragment()
            return mParseHtmlFragment
        }

        fun parseHtml(iParse: IParse) {
            mParseHtmlFragment.mIParse = iParse
        }
    }

    private lateinit var mX5WebView: X5WebView
    override fun initView(rootView: View?, savedInstanceState: Bundle?) {
        mX5WebView = X5WebView(requireContext())
        mView = mX5WebView
    }

    var mIParse: IParse? = null
        set(value) {
            field = value
            mX5WebView.mIParse = mIParse
        }

    override fun onDestroy() {
        super.onDestroy()
        mX5WebView.destroy()
    }
}